Repository navigation
FormTxt 0.36.0: one engine per data folder, an engine log, and a clean stop (engine side only) - #13
Merged
Merged
Conversation
…leaves with its app The family's start and stop pattern, as built in FormTools, on the engine side. backend/app/core/startup.py is FormTools's file with the names at its top changed. backend/app/core/runtime.py is new: the log file Logs/formtxt-engine.log in the data folder, and the lock's taking and giving up. backend/formtxt_engine.py serves in this order: the data folder and the log (exit code 5 and one sentence when the folder cannot be made), an absent standard error kept in Logs/formtxt-engine-errors.log, a frozen engine started with no app opens the app beside it or says it serves nothing on its own (exit code 4), the lock engine.lock (a second engine is refused with one sentence and exit code 2 while the first one's app lives, and an engine whose app is gone is ended and replaced), the watch on the app, then the port, the window key line and the server as before. --selfcheck is decided first and is unchanged. Kept: FORMTXT_PARENT_PID, which the shell of 0.35.0 sets, is read after FORMTXT_SHELL_PID for the lock, the watch and the started-alone question. Removed: the entry's own _alive and watch_parent; the family's take their place. A SIGTERM now gives the lock up and exits 0 after the server has shut down. FormTxt had no lock before, so no older lock can be met. Engines started without the entry (./formtxt, uvicorn app.main:app, the test fixtures) take no lock. Seen first on Linux, Python 3.13, engines from source with stand-in shells: the three closed-stream starts answered the health route; the second engine was refused and the first kept answering; the engine left about a second after its shell ended and the lock was gone; a holder whose shell was gone was replaced (SIGTERM, and SIGKILL after five seconds for one that was stopped); damaged locks and locks naming an unrelated process were replaced and that process kept running; started alone it opened the stand-in app in each of the four install layouts and took no lock, and with no app near it exited 4 with the sentence. Tests added after that: backend/tests/test_startup.py, 15 tests, FormTools's file with FormTxt's names; run with tests/test_f5_boot.py: 18 passed. Not run: Windows, macOS, a frozen engine.
…s, and the engine gets the shell's process id under the family's name src-tauri/src/main.rs, three small changes in the engine's start. The engine also gets FORMTXT_SHELL_PID beside FORMTXT_PARENT_PID. When the engine gives no address and key, the sentence is shown first and the loading window is closed only after it returns; it was closed first. The sentence says that a copy of FormTxt may already be open, since only one engine can use the data folder now, and where the engine's log is. Not compiled: the desktop shell cannot be built here. One added .env line beside its twin, one string, and two statements in another order. Not run on any system. Held: the rest of the family's shell side (the Windows job object, the failure text with the engine's last lines and exit code, a limit on the wait for the address). backend/HASHOUT_LOG.md says what it needs.
A minor release, engine side only: one engine per data folder with a lock, the engine's log file in the data folder, a frozen engine started alone opens the app, the engine leaves with its app by the family's watch, and in the shell the start failure is said before the loading window closes. The CHANGELOG entry lists them and says what is not in it: the Windows job object and the failure text with the engine's last lines, which wait for a session that can prove the shell's Rust.
Version sites, the same eleven files as 0.35.0: backend/app/__init__.py, frontend/src/version.ts, frontend/package.json, frontend/package-lock.json (the two fields of this project), src-tauri/Cargo.toml, src-tauri/Cargo.lock (package formtxt), src-tauri/tauri.conf.json, README.md (the badge and the version line), CHANGELOG.md (new entry), and the two header lines of backend/HASHOUT_LOG.md and frontend/HASHOUT_LOG.md. Left alone: setup/mcpb/manifest.json (0.0.0, stamped at build), the log entries headed "after v0.35.0", and the three browser demo pages.
Checked on a scratch copy of the engine commit, the workflow's jobs as written: compileall, --selfcheck, the boot probe, the engine's suite (222 passed), npm ci, npm run build, npm run typecheck, npm audit (0 vulnerabilities), the window check with Playwright 1.63.0 (2 passed), bash -n, agents check, mcpb check. On this tree: agents check, agents sync --check, mcpb check ("a build stamps version 0.36.0"), the icon rules and the em dash check, all clean.
Not run: the engine's suite on this exact tree (the machine's queue did not reach it before the clock; the tree differs from the checked commit by the version strings and three lines of the shell), a desktop build, Windows, macOS, a real agent program. The run was on Python 3.13; the workflow pins 3.12.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FormTxt 0.36.0: one engine per data folder, an engine log, and a clean stop (engine side only)
The start and stop pattern that FormTools 0.10.0 has, carried into FormTxt's engine. The shell side of the pattern is not in this release; see "Held".
What changes for people
Logs/formtxt-engine.login the FormTxt folder (1 MB, three older files kept). When the engine has no standard error, its errors go toLogs/formtxt-engine-errors.log.FORMTXT_PARENT_PID, which the shell of 0.35.0 sets, after the family'sFORMTXT_SHELL_PID.FORMTXT_SHELL_PID; when the engine cannot be started, the sentence is shown before the loading window closes (it was closed first); the sentence says a copy may already be open and where the log is../formtxt,uvicorn app.main:app, the test fixtures) take no lock and write no log file.Commits
How it was checked
All on Linux, Python 3.13 (the workflow pins 3.12), with stand-ins for the app (
sleep) and for the agent programs.Engines from source with stand-in shells, seen before any test was written: the entry with standard output closed, with output and error closed, and with all three closed answered its health route; a second engine was refused with the sentence while the first kept answering, and the refusal was in the log; the engine left about a second after its stand-in shell ended and the lock was gone (the same with only the older variable); a holder whose shell was gone was replaced, by SIGTERM when it was running and by SIGKILL after five seconds when it was stopped; locks holding text that is not JSON, a list, a wrong type and nothing were replaced; a lock naming an unrelated process was replaced and that process kept running; started alone, the stand-in app was opened in each of four install layouts with no lock and no port, and with no app near the exit code was 4 with the sentence.
Checks rehearsed, on a scratch copy of the engine commit (
git archive), the workflow's jobs as written:python -m compileall -q app formtxt_engine.pypython formtxt_engine.py --selfcheckpython -m uvicorn app.main:app --host 127.0.0.1 --port 8210, then the health routepython -m pytest tests -q -p no:cacheprovidernpm ci,npm run buildnpm run typechecknpm audit --audit-level=lowpython -m pytest frontend/tests/window -q -p no:cacheprovider, Playwright 1.63.0bash -non the launcher and setup scripts./formtxt agents check,./formtxt mcpb checkpython3 -B setup/icon_rules.py, the em dash and emoji checkThe shell commit after it changes only
src-tauri/src/main.rsand a log entry; no job of the workflow builds the shell. On the release tree the engine's suite was run again (222 passed, stand-ins started 0 times) and the script checks were repeated. The release commit's message says the suite was not run on that tree: the run was still waiting in the machine's queue when the message was written, and it finished, all passed, in the same minute.Held
win_job.rs(on Windows, the job object that ends the engine and everything it started when the shell ends, however it ends),engine_start.rs(the failure text with the engine's last lines, its exit code and the log's path) and a limit on the wait for the engine's address, which has none today. FormTxt starts its engine through tauri-plugin-shell, which gives no process handle for the job object; the way to take is FormTools's, moving that one start tostd::process::Command. The clock ran out before it could be proved with the scratch crate, and unproved Rust in the shell would cost a failed build.backend/HASHOUT_LOG.mdlists what that work must mind.Not run
backend/app/core/startup.pyis unrun: asking whether a process is alive, reading when it was created, ending a process tree withtaskkill, the wait on the shell's handle, and the detached start of the app.src-tauri/src/main.rsis the release build.sys.frozenset.Merge
Merge with a merge commit. Do not squash and do not rebase-merge.